#ifndef _APP_485_PROTOCOL_H_
#define _APP_485_PROTOCOL_H_

#include <stdint.h>

#define PROTOCOL_BUFFER_LEN     (512+16)    //缓冲区长度
#define PROTOCOL_HEAD           0xA55A      //协议头
#define PROTOCOL_ADDR           0xFF        //设备号

//命令解析模型
typedef uint16_t (*analyze_funtion)(uint8_t *pdata, uint16_t len);
typedef struct
{
    const uint16_t head;
    analyze_funtion analyse;
}command_module;

void Protocol_Analysis(void);
uint16_t Cmd_Analyse_State(uint8_t *pdata, uint16_t len);
uint16_t Cmd_Analyse_Battery(uint8_t *pdata, uint16_t len);
uint16_t Cmd_Analyse_Alarm(uint8_t *pdata, uint16_t len);

#endif
